home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10724 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: ix.netcom.com!news
  2. From: swampwiz@ix.netcom.com(Jean P. Laborde )
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: unsigned char question
  5. Date: 9 Mar 1996 19:03:29 GMT
  6. Organization: Netcom
  7. Message-ID: <4hskm1$ss6@dfw-ixnews2.ix.netcom.com>
  8. References: <3136864B.7154@eds.com>
  9. NNTP-Posting-Host: nor-la1-15.ix.netcom.com
  10. X-NETCOM-Date: Sat Mar 09  1:03:29 PM CST 1996
  11.  
  12. In <3136864B.7154@eds.com> Perry Hoekstra <lnusmsc.phoeks01@eds.com>
  13. writes: 
  14. >
  15. >This is a basic question but one I cannot answer.  I am using VC++ 2.0
  16. >and I wish to assign a string to a variable of type UCHAR * (which is
  17. an unsigned char 
  18. >within ODBC).  The code is as follows
  19. >
  20. >UCHAR * server;
  21. >
  22. >server = "jmbademo";
  23. >
  24.  
  25. You have just defined a temporary string, to which you had 'server'
  26. point.  After the ';', the temporary string was destroyed, so now
  27. 'server' is undefined.  Try this:
  28.  
  29. UCHAR server[] = "jmbademo"; // or something like this
  30.  
  31. You now have an array of UCHAR's which will exist for the duration of
  32. its scope (unless you do something foolish to delete it)
  33.  
  34. Comments Encouraged,
  35. The Swamp Wizard
  36.  
  37.